<?php
namespace Core\CoreContracts;

use Core;

/*
* Event attachment model definition. An user can add an attachment to en event
*
*/
class EventAttachment {

	/**
    * @property integer $Id The event attachment unique identifier
    */
	public $Id;

	/**
    * @property Event $Event The associated event
    */
	public $Event;
	
	/**
    * @property blob $Attachment The associated attachment to the event
    */
	public $Attachment;
	
	/**
    * @property string $AttachmentName The associated attachment name to the event
    */
	public $AttachmentName;
	
	/**
    * @property string $AttachmentMime The attachment mime
    */
	public $AttachmentMime;
	
	/**
    * @property string $AttachmentExtension The attachment extension
    */
	public $AttachmentExtension;
	
	/**
    * @property datetime $ModificationDate The event subscription modification date
    */
	public $ModificationDate;
	
	/**
    * @property datetime $CreationDate The event subscription creation date
    */
	public $CreationDate;
	
	/**
	* The default constructor
	*/
	public function __construct()  {  }
	
	/*
	* Build a new event attachment object
	*
	* @param integer $eventId The event id
	* @param string $attachmentName The content file
	* @param blob $attachment The content file
	* @param string $attachmentMime The mime file
	* @param string $attachmentExtension The extension file
	*/
	public static function Create($eventId, $attachmentName, $attachment, $attachmentMime, $attachmentExtension)
	{
		$eventAttachment = new EventAttachment();
		$eventAttachment->Event = $eventId;
		$eventAttachment->Attachment = $attachment;
		$eventAttachment->AttachmentName = $attachmentName;
		$eventAttachment->AttachmentMime = $attachmentMime;
		$eventAttachment->AttachmentExtension = $attachmentExtension;
		$eventAttachment->ModificationDate = date("Y-m-d H:i:s");
		$eventAttachment->CreationDate = date("Y-m-d H:i:s");
		return $eventAttachment ;
	}
}
?> 